﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage< SDT.Admin.ViewModels.CompanyIndexViewModel>" %>

<%@ Import Namespace="SDT.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Thêm mới doanh nghiệp
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (ViewData["MessageInfo"] == null)
      { %>
    <% using (Html.BeginForm("Create", "Company", FormMethod.Post, new { id = "adminForm",name="adminForm", enctype = "multipart/form-data" }))
       {%>
    <%= Html.ValidationSummary(true)%>
    <fieldset>
        <legend>Thêm mới</legend><font color="red">(*)</font> là trường bắt buộc phải nhập.
        <table class="adminlist" width="100%">
            <thead>
                <tr align="center">
                    <th align="center">
                        Thông tin doanh nghiệp
                    </th>
                    <th align="center">
                        Lĩnh vực hoạt động
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <table class="admintable">
                            <tbody>
                                <tr>
                                    <td class="key">
                                        Tên doanh nghiệp (<font color="red">*</font>)
                                    </td>
                                    <td>
                                        <%= Html.TextBoxFor(model => model.Company.Name, new { @class = "required",style="width:500px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Tên vắn tắt (<font color="red">*</font>)
                                    </td>
                                    <td>
                                        <%= Html.TextBoxFor(model => model.Company.ShortName, new { @class = "required",style="width:500px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Địa chỉ (<font color="red">*</font>)
                                    </td>
                                    <td>
                                        <%= Html.TextBoxFor(model => model.Company.Address, new { @class = "required",style="width:500px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Tỉnh thành
                                    </td>
                                    <td>
                                        <%=Html.DropDownListFor(m => m.Company.CityID,Model.ListCity, "-- Chọn tỉnh thành --", new {style ="width:222px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">Quận/Huyện</td>
                                    <td>
                                        <%=Html.DropDownListFor(m => m.Company.DistrictID,Model.ListDistrict, "-- Chọn quận huyện --", new { style="width:222px"})%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Logo
                                    </td>
                                    <td>
                                        <input type="file" name="CompanyFile" id="CompanyFile" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Số điện thoại
                                    </td>
                                    <td>
                                        <%= Html.TextBoxFor(model => model.Company.Phone, new {style="width:218px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Fax
                                    </td>
                                    <td>
                                        <%= Html.TextBoxFor(model => model.Company.Fax, new {style="width:218px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Website
                                    </td>
                                    <td>
                                        <%= Html.TextBoxFor(model => model.Company.Website, new {style="width:500px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Yahoo ID
                                    </td>
                                    <td>
                                        <%= Html.TextBoxFor(model => model.Company.YahooID, new {style="width:500px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Skype ID
                                    </td>
                                    <td>
                                        <%= Html.TextBoxFor(model => model.Company.SkypeID, new {style="width:500px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Độ ưu tiên (<font color="red">*</font>)
                                    </td>
                                    <td>
                                        <%= Html.TextBoxFor(m => m.Company.Priority, new { @class = "required",style="width:30px" })%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Trạng thái kích hoạt (<font color="red">*</font>)
                                    </td>
                                    <td>
                                        <%=Html.RadioButton("Company.ActiveYN", true, new { @checked = "checked" })%>Kích
                                        hoạt
                                        <%=Html.RadioButton("Company.ActiveYN", false)%>Không kích hoạt
                                    </td>
                                </tr>
                                <tr>
                                    <td class="key">
                                        Trạng thái "Hot"(<font color="red">*</font>)
                                    </td>
                                    <td>
                                        <%=Html.RadioButton("Company.HotYN", true, new { @checked = "checked" })%>
                                        Hot
                                        <%=Html.RadioButton("Company.HotYN", false)%>
                                        Không hot
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                    <td valign="top">
                        <table>
                            <tr>
                                <td align="left" valign="top">
                                    <ul style="margin:0;padding:0;list-style-type:none;">
                                        <% foreach (var itemType in Model.CompanyTypes)
                                           {%>
                                        <li>
                                            <input type="checkbox" id="CompanyType.<%=itemType.ID %>" name="CompanyType.<%=itemType.ID %>"  value="true"/>
                                            <%=Html.Encode(itemType.Name)%>
                                        </li>
                                        <%} %>
                                    </ul>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table class="admintable">
                            <tr>
                                <td class="key">
                                    Giới thiệu về doanh nghiệp
                                </td>
                                <td>
                                    <%= Html.TextAreaFor(m => m.Company.Description, new { rows = "30", cols = 20, style = "width:760px" })%>
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    Lịch sử hình thành và phát triển
                                </td>
                                <td>
                                    <%= Html.TextAreaFor(m => m.Company.Development, new { rows = "30", cols = 20, style = "width:760px" })%>
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    Sơ đồ tổ chức
                                </td>
                                <td>
                                    <%= Html.TextAreaFor(m => m.Company.OrgStructure, new { rows = "30", cols = 20, style = "width:760px" })%>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <input type="submit" value="Thêm mới" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <% }
      } %>

    <script type="text/javascript">
        $(document).ready(function() {
        $("#adminForm").validate();

        $("#Company_CityID").unbind("change").change(function() {
        var val = $("#Company_CityID").val();
                if (val == "" || val == '' || val == undefined)
                    return false;
                AjaxChange("#Company_CityID", "#Company_DistrictID", "/AjaxData/LoadDistrictByCity/");
            });
        });
        tinyMCE.init({
            mode: "exact",
            elements: "Company_Description",
            theme: "advanced",
            plugins: "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,paste,imagemanager",
            theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
            theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
            theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            paste_use_dialog: false,
            paste_auto_cleanup_on_paste: true,
            paste_convert_headers_to_strong: false,
            paste_strip_class_attributes: "all",
            paste_remove_spans: true,
            paste_remove_styles: true
        });
    </script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
    <td>
        <%= Html.Toolbar("Quay về", "/Company/Index/", "back") %>
    </td>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Thêm mới doanh nghiệp
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>
</asp:Content>
